package com.ruoyi.project.mahjong.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mahjong.mapper.OtherPriceMapper;
import com.ruoyi.project.mahjong.domain.OtherPrice;
import com.ruoyi.project.mahjong.service.IOtherPriceService;

/**
 * 其他消费Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-06
 */
@Service
public class OtherPriceServiceImpl implements IOtherPriceService
{
    @Autowired
    private OtherPriceMapper otherPriceMapper;

    /**
     * 查询其他消费
     *
     * @param id 其他消费ID
     * @return 其他消费
     */
    @Override
    public OtherPrice selectOtherPriceById(Long id)
    {
        return otherPriceMapper.selectOtherPriceById(id);
    }

    /**
     * 查询其他消费列表
     *
     * @param otherPrice 其他消费
     * @return 其他消费
     */
    @Override
    public List<OtherPrice> selectOtherPriceList(OtherPrice otherPrice)
    {
        return otherPriceMapper.selectOtherPriceList(otherPrice);
    }

    /**
     * 新增其他消费
     *
     * @param otherPrice 其他消费
     * @return 结果
     */
    @Override
    public int insertOtherPrice(OtherPrice otherPrice)
    {
        otherPrice.setCreateTime(DateUtils.getNowDate());
        return otherPriceMapper.insertOtherPrice(otherPrice);
    }

    /**
     * 修改其他消费
     *
     * @param otherPrice 其他消费
     * @return 结果
     */
    @Override
    public int updateOtherPrice(OtherPrice otherPrice)
    {
        otherPrice.setUpdateTime(DateUtils.getNowDate());
        return otherPriceMapper.updateOtherPrice(otherPrice);
    }

    /**
     * 批量删除其他消费
     *
     * @param ids 需要删除的其他消费ID
     * @return 结果
     */
    @Override
    public int deleteOtherPriceByIds(Long[] ids)
    {
        return otherPriceMapper.deleteOtherPriceByIds(ids);
    }

    /**
     * 删除其他消费信息
     *
     * @param id 其他消费ID
     * @return 结果
     */
    @Override
    public int deleteOtherPriceById(Long id)
    {
        return otherPriceMapper.deleteOtherPriceById(id);
    }

    @Override
    public List<OtherPrice> selectByOther(OtherPrice otherPrice) {
        return otherPriceMapper.selectByOther(otherPrice.getStartTime(),otherPrice.getEndTime(),otherPrice.getShopId(),otherPrice.getType());
    }
}
